# coding:utf8
import pymysql

class DataCollectManage(object):
	def do(self,data):
		db = pymysql.connect("localhost","root","123456",'tools_db')
		cursor = db.cursor()

		sql = "INSERT INTO posts(`title`,`content`,`author`,`click`) VALUES('%s','%s','admin',0)" % (data['title'].strip(),data['content'].strip())
		try:
			cursor.execute(sql)
			db.commit()
		except:
			db.rollback()
		finally:
			db.close()